%%
%多元微积分实验
%3.1.1
clear,clc,
a = -4:0.2:4;
b = -5:0.2:5;
[x,y] = meshgrid(a,b);

z = exp((-x.^2-y.^2)./8)./(2*nthroot(2*pi,2));
%plot3(x,y,z)
surf(x,y,z,'LineStyle','--','FaceColor','g','EdgeColor','r')
%%
%3.1.2
clear,clc,
a = -9:0.1:9;
b = -9:0.1:9;
[x,y] = meshgrid(a,b);

z = (sin(nthroot(x.^2+y.^2,2)))./(nthroot(x.^2+y.^2,2));
subplot(2,2,1);
plot3(x,y,z,'r--','Color','r');
subplot(2,2,2);
mesh(x,y,z,'FaceColor','g','EdgeColor','r');
subplot(2,2,3);
meshc(x,y,z,'FaceColor','g','EdgeColor','r');
subplot(2,2,4);
surfc(x,y,z,'FaceColor','g','EdgeColor','r');
%%
%扩展题
clear
r = 0:0.1:9;
t = 0:pi/50:2*pi;
[R,T] = meshgrid(r,t);
x = R.*cos(T);
y = R.*sin(T);

z = (sin(nthroot(x.^2+y.^2,2)))./(nthroot(x.^2+y.^2,2));
subplot(2,2,1);
plot3(x,y,z,'r--','Color','r');
subplot(2,2,2);
mesh(x,y,z,'FaceColor','g','EdgeColor','r');
subplot(2,2,3);
meshc(x,y,z,'FaceColor','g','EdgeColor','r');
subplot(2,2,4);
surfc(x,y,z,'FaceColor','g','EdgeColor','r');

%%
%等高线的绘制
%3.1.2
clc,clear,clf
[x,y] = meshgrid(-4:0.2:4);
z = x.^3+y.^3-12.*x-12.*y;
figure(1)
mesh(x,y,z)
figure(2)
[c,h] = contour(x,y,z);
clabel(c,h)
figure(3)
h1 = [-28 -16 -8 0 6 18 26];
c1 = contour(z,h1);
clabel(c1)
figure(4)
contourf(z)
figure(5)
contour3(z,10)
hold off
%%
clc
clear
clf
t = 0:0.03:2*pi;
s = [-2:0.03:2]';
x = (0*s+1)*cos(t);
y = (0*s+1)*sin(t);
z = s*(0*t+1);
mesh(x,y,z),
hold on,
mesh(x,z,y),
axis equal
%%
%3.1.5













